package gwtI18nEditor.resources;

import java.util.HashMap;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public class ImageLibrary {
    private static HashMap<String, ImageIcon> images = new HashMap<String, ImageIcon>();
    
    public static Icon get(String URL) {
            if (!images.containsKey(URL)) {
                java.net.URL imgURL = ImageLibrary.class.getResource("images/"+URL);
                if (imgURL != null) {
                    images.put(URL, new ImageIcon(imgURL, ""));
                } else {
                    System.err.println("Couldn't find file: " + URL);
                    return null;
                }
            }
            return images.get(URL);
    }
}
